import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const menu = {
    state:{
        //展开节点列表
        openNames:[],
        //当前选中节点
        activeName:""
    },
    mutations:{
        setOpenNames(state,openNames){
            state.openNames = openNames
        },
        setActiveName(state,activeName){
            state.activeName = activeName
        }
    },
    actions:{
        asyncSetOpenNames(store,openNames){
            store.commit('setOpenNames',openNames)
        },
        asyncSetActiveName(store,activeName){
            store.commit('setActiveName',activeName)
        }
    },
    getters:{
        getName(state){
            return state.name
        },
        getOpenNames(state){
            return state.openNames
        },
        getActiveName(state){
            return state.activeName
        }
    }
}
export default menu;